<template>
  <div class="c">
    <h2>child组件</h2>
    <!-- 不推荐子改变数据，导致上层数据紊乱 -->
    <div @click="money++">money:{{ money }}</div>
  </div>
</template>
    
<script setup>
import { inject } from "vue";
// 注入数据
// inject("注入名",默认值)
const money = inject("money");
</script>
    
<style lang="scss" scoped>
.c {
  width: 250px;
  height: 250px;
  border: 2px solid blue;
  margin-left: 50px;
}
</style>